#include <iostream>
#include "MessageDigest.h"
#include "MD5.h"
#include "HMAC.h"

using namespace std;

void testhmac() {
	char digest[128];
	for(string k, s; cin>>k>>s; ) {
		HMAC hmac(MessageDigest::TYPE_MD5);
		//HMAC hmac(MessageDigest::TYPE_SHA1);
		//HMAC hmac(MessageDigest::TYPE_SHA256);
		hmac.init(k.c_str(), k.length());
		hmac.update(s.c_str(), s.length());
		hmac.final();
		
		cout<<"digest length="<<hmac.getSize()<<endl;
		hmac.digestHex(digest);
		cout<<hmac.getDigestHex()<<endl;
		printf("  %s\n", digest);
	}
}

void testmd() {
	char digest[128];
	for(string s; cin>>s; ) {
		MessageDigest md(MessageDigest::TYPE_MD5);
		//MessageDigest md(MessageDigest::TYPE_SHA1);
		//MessageDigest md(MessageDigest::TYPE_SHA256);
		md.init();
		md.update(s.c_str(), s.length());
		md.final();
		
		cout<<"digest length="<<md.getSize()<<endl;
		md.digestHex(digest);
		cout<<md.getDigestHex()<<endl;
		printf("  %s\n", digest);
	}
}

int main() {
	testmd();
	//testhmac();
	return 0;
}